<?php
class ViewTypeJob extends CWidget {

	
    public function init() {
		parent::init();
		
	}
	
    public function ViewTypeJob() {
			
		$post = new Job();
		$id = $_GET['id'];
			
		$criteria = new CDbCriteria(array(
                        'condition'=>'status=:status',
                        'params'=>array(':status'=>2),
                ));
				
		$criteria2 = new CDbCriteria(array(
                        'condition'=>'subjobtype_id=:subjobtype_id',
                        'params'=>array(':subjobtype_id'=>$id),
                ));
		$criteria->mergeWith($criteria2);
		
		$page = new CPagination();
		$page->setItemCount(Job::model()->count($criteria));
		$page->setPageSize(15);
		$page->applyLimit($criteria);
		$model = Job::model()->findAll($criteria);
		
        $this->render('viewTypeJob', array(
			'post'=>$post,
			'page'=>$page,
			'model'=>$model,
        ));
    }
}
?>